<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
<title>地图找房</title>

<script type="text/javascript" src="__PUBLIC__/index/js/jquery-1.8.1.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=3MBx3mG3POj2CG1Pd5mhD6Lz"></script>
<style>
	body,body * {margin: 0px;padding: 0px;list-style: none;border: 0px;}
	#map_for{ width: 100%; height: 100%; position: absolute;}
</style>

</head>
<body>
	
	<div id="map_for">
	
	</div>
 	
</body>
<script type="text/javascript">
	var map = new BMap.Map("map_for");  // 创建Map实例
	map.enableScrollWheelZoom(); //开启鼠标滚轮缩放
	var localSearch = new BMap.LocalSearch(map);
	searchByStationName();
	function searchByStationName(){
	 localSearch.setSearchCompleteCallback(function (searchResult) {
        var poi = searchResult.getPoi(0);  
        var myIcon = new BMap.Icon("__PUBLIC__/admin/image/dtb.gif", new BMap.Size(85,85));//图标
        var point = new BMap.Point(poi.point.lng, poi.point.lat);
      
        var marker = new BMap.Marker(point,{icon:myIcon});  // 创建标注，为要查询的地方对应的经纬度
        map.addOverlay(marker);      
        map.centerAndZoom(point, 11);
      
   });
    var data=eval('<?php echo $map; ?>'); 
    for(var i=0;i<data.length;i++){
		localSearch.search(data[i].map);
		}
	}
</script>
</html>








